Srcs := $(wildcard *.c)
Objs := $(patsubst %.c, %.o, $(Srcs))
Exe := serve

CC := gcc
CFLAGS := -Wall -g -lpthread -lcrypt -lmysqlclient

.PHONY: Out clean rebuild

Out: $(Exe)

$(Exe): $(Objs)
	$(CC) $^ -o $@ $(CFLAGS)
	$(RM) $(Objs)

%.o: %.c
	$(CC) -c $< -o $@ $(CFLAGS)

clean:
	$(RM) $(Exe)
